package com.xg.frame.exception;

import com.xg.frame.entity.ConstantCode;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

/**
 * @author helen
 * @since 2019/1/12
 */
@Data
@ApiModel(value = "全局异常")
public class SqException extends RuntimeException {


    @ApiModelProperty(value= "错误码")
    private Integer code;

    @ApiModelProperty(value = "错误消息")
    private String msg;

    public SqException(Integer code,String msg) {
        this.msg = msg;
        this.code = code;
    }

    public SqException(String msg) {
        this.msg = msg;
        this.code = ConstantCode.ERROR.getCode();
    }

    public SqException(String msg, Throwable t) {
        super(t);
        this.msg = msg;
        this.code = ConstantCode.ERROR.getCode();
    }

}
